package com.skynet.springboot.mybatis.springmybatis.service.impl;

import com.skynet.springboot.mybatis.springmybatis.dao.EmployeeDao;
import com.skynet.springboot.mybatis.springmybatis.entity.Employee;
import com.skynet.springboot.mybatis.springmybatis.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Skynet
 * @Date 2017/9/8-0:07.
 */
@Service
public class EmployeeServiceImpl implements EmployeeService {

    @Autowired
    private EmployeeDao employeeDao;

    @Override
    public List<Employee> queryAllEmployee() {
        return employeeDao.queryAll();
    }

    @Override
    public Employee queryEmployeeById(Integer id) {
        return employeeDao.queryObject(id);
    }

    @Override
    public void saveEmployee(Employee employee) {
        employeeDao.save(employee);
    }

    @Override
    public Integer updateEmployee(Employee employee) {
        return employeeDao.update(employee);
    }

    @Override
    public Integer deleteEmployeeById(Object id) {
        return employeeDao.delete(id);
    }

    @Override
    public Employee queryEmpByIdAndName(Integer id, String name) {
        return employeeDao.queryEmpByIdAndName(id, name);
    }
}
